<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>消息中心 - 学生知识管理系统</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            color: #333;
        }

        .navbar {
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            padding: 1rem 0;
            box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
            position: sticky;
            top: 0;
            z-index: 1000;
        }

        .nav-container {
            max-width: 1200px;
            margin: 0 auto;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 2rem;
        }

        .logo {
            font-size: 1.5rem;
            font-weight: bold;
            color: #667eea;
            text-decoration: none;
        }

        .nav-links {
            display: flex;
            list-style: none;
            gap: 2rem;
        }

        .nav-links a {
            text-decoration: none;
            color: #333;
            font-weight: 500;
            transition: color 0.3s ease;
        }

        .nav-links a:hover {
            color: #667eea;
        }

        .container {
            max-width: 1200px;
            margin: 2rem auto;
            padding: 0 2rem;
            display: flex;
            gap: 2rem;
        }

        .sidebar {
            width: 250px;
            background: white;
            border-radius: 15px;
            padding: 2rem;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
            height: fit-content;
        }

        .profile-avatar {
            text-align: center;
            margin-bottom: 2rem;
        }

        .avatar {
            width: 80px;
            height: 80px;
            border-radius: 50%;
            background: linear-gradient(135deg, #667eea, #764ba2);
            color: white;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 2rem;
            font-weight: bold;
            margin: 0 auto 1rem;
        }

        .sidebar-menu {
            list-style: none;
        }

        .sidebar-menu li {
            margin-bottom: 0.5rem;
        }

        .sidebar-menu a {
            display: block;
            padding: 0.75rem 1rem;
            text-decoration: none;
            color: #666;
            border-radius: 8px;
            transition: all 0.3s ease;
        }

        .sidebar-menu a:hover,
        .sidebar-menu a.active {
            background: linear-gradient(135deg, #667eea, #764ba2);
            color: white;
        }

        .main-content {
            flex: 1;
            background: white;
            border-radius: 15px;
            padding: 2rem;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
        }

        .page-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 2rem;
        }

        .page-title {
            font-size: 2rem;
            color: #333;
        }

        .message-filters {
            display: flex;
            gap: 0.5rem;
            margin-bottom: 2rem;
        }

        .filter-btn {
            padding: 0.5rem 1rem;
            border: 1px solid #ddd;
            background: white;
            border-radius: 20px;
            cursor: pointer;
            transition: all 0.3s ease;
            font-size: 0.9rem;
        }

        .filter-btn.active,
        .filter-btn:hover {
            background: #667eea;
            color: white;
            border-color: #667eea;
        }

        .messages-list {
            list-style: none;
        }

        .message-item {
            background: #f8f9fa;
            border-radius: 10px;
            padding: 1.5rem;
            margin-bottom: 1rem;
            transition: all 0.3s ease;
            border-left: 4px solid transparent;
        }

        .message-item:hover {
            transform: translateX(5px);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        }

        .message-item.unread {
            border-left-color: #667eea;
            background: rgba(102, 126, 234, 0.05);
        }

        .message-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1rem;
        }

        .message-type {
            display: inline-block;
            padding: 0.25rem 0.75rem;
            border-radius: 15px;
            font-size: 0.8rem;
            font-weight: 500;
        }

        .type-system {
            background: #e3f2fd;
            color: #1976d2;
        }

        .type-comment {
            background: #f3e5f5;
            color: #7b1fa2;
        }

        .type-like {
            background: #ffebee;
            color: #c62828;
        }

        .type-follow {
            background: #e8f5e8;
            color: #2e7d32;
        }

        .message-time {
            font-size: 0.9rem;
            color: #666;
        }

        .message-title {
            font-size: 1.1rem;
            font-weight: bold;
            color: #333;
            margin-bottom: 0.5rem;
        }

        .message-content {
            color: #666;
            line-height: 1.6;
            margin-bottom: 1rem;
        }

        .message-actions {
            display: flex;
            gap: 0.5rem;
        }

        .btn {
            background: linear-gradient(135deg, #667eea, #764ba2);
            color: white;
            border: none;
            padding: 0.5rem 1rem;
            border-radius: 20px;
            cursor: pointer;
            font-size: 0.9rem;
            font-weight: 500;
            transition: all 0.3s ease;
            text-decoration: none;
            display: inline-block;
        }

        .btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
        }

        .btn-secondary {
            background: #6c757d;
        }

        .btn-secondary:hover {
            box-shadow: 0 5px 15px rgba(108, 117, 125, 0.4);
        }

        .empty-state {
            text-align: center;
            padding: 4rem 2rem;
            color: #666;
        }

        .empty-icon {
            font-size: 4rem;
            margin-bottom: 1rem;
        }

        .alert {
            padding: 1rem;
            border-radius: 8px;
            margin-bottom: 1rem;
        }

        .alert-error {
            background: #f8d7da;
            color: #721c24;
            border: 1px solid #f5c6cb;
        }

        .coming-soon {
            text-align: center;
            padding: 4rem 2rem;
            background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
            border-radius: 15px;
            margin: 2rem 0;
        }

        .coming-soon-icon {
            font-size: 4rem;
            margin-bottom: 1rem;
        }

        .coming-soon h3 {
            color: #667eea;
            margin-bottom: 1rem;
        }

        .coming-soon p {
            color: #666;
            line-height: 1.6;
        }

        .feature-list {
            list-style: none;
            margin-top: 2rem;
            text-align: left;
            max-width: 400px;
            margin-left: auto;
            margin-right: auto;
        }

        .feature-list li {
            padding: 0.5rem 0;
            color: #666;
        }

        .feature-list li:before {
            content: "✨";
            margin-right: 0.5rem;
        }

        .unread-badge {
            background: #dc3545;
            color: white;
            border-radius: 50%;
            width: 20px;
            height: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.8rem;
            font-weight: bold;
        }
    </style>
</head>
<body>
    <!-- 导航栏 -->
    <nav class="navbar">
        <div class="nav-container">
            <a href="/" class="logo">📚 学生知识管理系统</a>
            <ul class="nav-links">
                <li><a href="/">🏠 首页</a></li>
                <li><a href="/articles">📝 文章</a></li>
                <li><a href="/categories">📂 分类</a></li>
                <li><a href="/profile">👤 个人中心</a></li>
                <li><a href="/logout">🚪 退出</a></li>
            </ul>
        </div>
    </nav>

    <div class="container">
        <!-- 侧边栏 -->
        <aside class="sidebar">
            <div class="profile-avatar">
                <div class="avatar" th:if="${user.avatar == null}" th:text="${user.nickname != null ? user.nickname.substring(0,1) : user.username.substring(0,1)}">U</div>
                <img th:if="${user.avatar != null}" th:src="${user.avatar}" alt="用户头像" class="avatar" style="width: 60px; height: 60px; border-radius: 50%; object-fit: cover;">
                <h3 th:text="${user.nickname != null ? user.nickname : user.username}">用户名</h3>
            </div>
            <ul class="sidebar-menu">
                <li><a href="/profile">📝 个人资料</a></li>
                <li><a href="/profile/avatar">🖼️ 头像管理</a></li>
                <li><a href="/profile/points">⭐ 积分管理</a></li>
                <li><a href="/profile/articles">📚 我的文章</a></li>
                <li><a href="/profile/favorites">❤️ 我的收藏</a></li>
                <li><a href="/profile/follows">👥 我的关注</a></li>
                <li><a href="/profile/messages" class="active">💬 消息中心</a></li>
            </ul>
        </aside>

        <!-- 主要内容 -->
        <main class="main-content">
            <div class="page-header">
                <h1 class="page-title">💬 消息中心</h1>
                <button class="btn btn-secondary">全部标记为已读</button>
            </div>

            <!-- 错误信息 -->
            <div th:if="${error}" class="alert alert-error">
                <span th:text="${error}"></span>
            </div>

            <!-- 消息过滤器 -->
            <div class="message-filters">
                <button class="filter-btn active" onclick="filterMessages('all')">全部消息</button>
                <button class="filter-btn" onclick="filterMessages('unread')">未读消息 <span class="unread-badge">0</span></button>
                <button class="filter-btn" onclick="filterMessages('system')">系统消息</button>
                <button class="filter-btn" onclick="filterMessages('comment')">评论回复</button>
                <button class="filter-btn" onclick="filterMessages('like')">点赞通知</button>
            </div>

            <!-- 功能开发中提示 -->
            <div class="coming-soon">
                <div class="coming-soon-icon">🚧</div>
                <h3>消息中心开发中</h3>
                <p>我们正在努力开发消息通知功能，敬请期待！</p>
                
                <ul class="feature-list">
                    <li>文章评论和回复通知</li>
                    <li>点赞和收藏提醒</li>
                    <li>系统公告和更新通知</li>
                    <li>关注用户动态推送</li>
                    <li>私信和聊天功能</li>
                    <li>消息分类和筛选</li>
                </ul>
            </div>

            <!-- 消息列表（当功能实现后使用） -->
            <div th:if="${messages != null and !messages.isEmpty()}" style="display: none;">
                <ul class="messages-list">
                    <li class="message-item unread" data-type="system">
                        <div class="message-header">
                            <span class="message-type type-system">系统消息</span>
                            <span class="message-time">2024-01-01 12:00</span>
                        </div>
                        <div class="message-title">欢迎使用学生知识管理系统</div>
                        <div class="message-content">感谢您注册我们的平台，开始您的知识分享之旅吧！</div>
                        <div class="message-actions">
                            <button class="btn">标记已读</button>
                            <button class="btn btn-secondary">删除</button>
                        </div>
                    </li>
                    
                    <li class="message-item" data-type="comment">
                        <div class="message-header">
                            <span class="message-type type-comment">评论回复</span>
                            <span class="message-time">2024-01-01 11:30</span>
                        </div>
                        <div class="message-title">有人回复了您的评论</div>
                        <div class="message-content">用户张三在文章《Spring Boot入门》中回复了您的评论...</div>
                        <div class="message-actions">
                            <button class="btn">查看详情</button>
                            <button class="btn btn-secondary">删除</button>
                        </div>
                    </li>
                    
                    <li class="message-item" data-type="like">
                        <div class="message-header">
                            <span class="message-type type-like">点赞通知</span>
                            <span class="message-time">2024-01-01 10:15</span>
                        </div>
                        <div class="message-title">您的文章获得了点赞</div>
                        <div class="message-content">用户李四点赞了您的文章《Java基础知识总结》</div>
                        <div class="message-actions">
                            <a th:href="@{/articles/{id}(id=${message.articleId})}" class="btn">查看文章</a>
                            <button class="btn btn-secondary">删除</button>
                        </div>
                    </li>
                </ul>
            </div>

            <!-- 空状态（当功能实现后使用） -->
            <div th:if="${messages != null and messages.isEmpty()}" class="empty-state" style="display: none;">
                <div class="empty-icon">💬</div>
                <h3>暂无消息</h3>
                <p>当有新的通知时，会在这里显示</p>
            </div>
        </main>
    </div>

    <script>
        function filterMessages(type) {
            // 移除所有按钮的active类
            document.querySelectorAll('.filter-btn').forEach(btn => {
                btn.classList.remove('active');
            });
            
            // 添加active类到当前按钮
            event.target.classList.add('active');
            
            // 显示/隐藏消息
            const items = document.querySelectorAll('.message-item');
            items.forEach(item => {
                const itemType = item.getAttribute('data-type');
                const isUnread = item.classList.contains('unread');
                
                if (type === 'all' || 
                    (type === 'unread' && isUnread) || 
                    (type !== 'unread' && type === itemType)) {
                    item.style.display = 'block';
                } else {
                    item.style.display = 'none';
                }
            });
        }
    </script>
</body>
</html>